package org.streets;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;

public class RandomCard {
	

	public static List<Integer> random(int[] cards, int num) {
		
		Set<Integer> _cards = new HashSet<Integer>();
		
		List<Integer> result = new ArrayList<Integer>();
		
		for (int i : cards) {
			_cards.add(i);
		}
		
		Random random = new Random(54);
		
		for (int i=0; i<num;) {
			int r = random.nextInt();
			while (_cards.contains(r)) {
				r = random.nextInt();
			}
			result.add(r);
			i++;
		}
		
		return result;
	}
	
	public static void main(String[] args) {
		List<Integer> result = RandomCard.random(new int[]{2,5}, 3);
		for (Integer i : result) {
			System.out.println(i);
		}
	}
}
